<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
    <meta charset="utf-8">
    <title>HOSPITAL</title>
    <script src="../static/js/jQuery.min.js" charset="utf-8"></script>
    <script src="../static/js/bootstrap.min.js" charset="utf-8"></script>
    <script src="../static/vue/vue.min.js"></script>
    <script src="../static/vue/vue-tables-2.min.js"></script>


    <link rel="stylesheet" href="../static/css/bootstrap.min.css">

    <!-- 引入样式 -->
    <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
    <!-- 引入组件库 -->
    <script src="https://unpkg.com/element-ui/lib/index.js"></script>

    <style media="screen">
        .margin-top-5{margin-top: 5px;}
        .padding-side-100{padding-left: 100px;padding-right: 100px;}
    </style>

</head>
<body>
<div class="container-fluid" id="master-page">

    <!-- main view -->
    <div class="row text-center">
        <h1>再保险合同上传</h1>
    </div>
    <div class="row margin-top-5 padding-side-100">
        <div class="col-md-12 well">
            <div class="col-xs-6">
                <span>合同名称 </span>
            </div>
            <div class="col-xs-3">
                <span><input type="text" class="form-control" v-model="new_data.ContName" ></input></span>
            </div>
        </div>
        <div class="col-md-12 well">
            <div class="col-xs-6">
                <span>合同编码</span>
            </div>
            <div class="col-xs-3">
                <span><input type="text" class="form-control" v-model="new_data.ContNo" ></input></span>
            </div>
        </div>
        <div class="col-md-12 well">
            <div class="col-xs-6">
                <span>保险公司</span>
            </div>
            <div class="col-xs-6">
                <span><input type="text" class="form-control" v-model="new_data.Company"></input></span>
            </div>
        </div>
        <div class="col-md-12 well">
            <div class="col-xs-6">
                <span>再保险公司</span>
            </div>
            <div class="col-xs-6">
                <span><input type="text" class="form-control" v-model="new_data.ReCompany" ></input></span>
            </div>
        </div>
        <div class="col-md-12 well">
            <div class="col-xs-6">
                <span>产品代码</span>
            </div>
            <div class="col-xs-6">
                <span><input type="text" class="form-control" v-model="new_data.riskcode" ></input></span>
            </div>
        </div>
        <div class="col-md-12 well">
            <div class="col-xs-6">
                <span>哈希地址</span>
            </div>
            <div class="col-xs-6">
                <span><input type="text" class="form-control" v-model="new_data.hashadd" ></input></span>
            </div>
        </div>
        <div class="col-md-12 well">
            <div class="col-xs-6">
                <span>合同周期</span>
            </div>
            <div class="col-xs-6">
                <span><input type="text" class="form-control" v-model="new_data.period" ></input></span>
            </div>
        </div>

    </div>

    <div class="row margin-top-5 padding-side-100">
        <div class="col-md-12">
            <button @click="uploadCR()">upload</button>
        </div>
    </div>
    </div><!-- /.modal -->
</div>

</body>

<!-- map for  chinese name -->
<script src="../static/info/map.js" charset="utf-8"></script>
<!-- vue -->
<script>
    // var ServerIP = window.location.host
    var ServerIP = "localhost:"+window.location.port

    Vue.use(VueTables.ClientTable);
    var app = new Vue({
        el: '#master-page',
        methods: {
            func: function(){
                var _this = this;
                var postData = {};
                postData["receiver"] = 999;
                console.log(postData)
                $.post("...",postData,function(data,status){
                    if (status=="success") {
                        console.log(data)
                    }else{alert("Error!Code: "+status);}
                });
                return;
            },
            uploadCR: function(){
                let _this = this
                _this.busy = true
                var postData = {
                    "ContName":this.new_data.ContName,
                    "ContNo":this.new_data.ContNo,
                    "startdata":(new Date()).getTime(),
                    "Company":this.new_data.Company,
                    "ReCompany":this.new_data.ReCompany,
                    "riskcode":this.new_data.riskcode,
                    "hashadd":this.new_data.hashadd,
                    "period":this.new_data.period,
                }
                console.log(postData);

                $.ajax({
                    type: 'POST',
                    url: "http://" + ServerIP + "/reinsuranceCon",
                    data: JSON.stringify(postData),
                    success: function(result){
                        console.log(result);
                        _this.busy = false
                        alert("success")
                        location.reload()
                        //code:: notice hospital the result.
                    },
                    dataType: "json"
                });
                return 0
            },
        },
        computed: {
        },
        created(){
            // this.fetch_person_info();
            // this.fetch_history_record();
        }
    });
</script>
</html>
